package vip.sweet.biz.modular.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.sweet.biz.modular.user.entity.BizUser;
import vip.sweet.biz.modular.user.params.BizUserAddParams;
import vip.sweet.biz.modular.user.params.CustomerLoginParams;
import vip.sweet.biz.modular.user.service.BizUserService;
import vip.sweet.common.response.CommonResponse;

/**
 * @author ASUS
 * @Date 2025/10/4 12:23
 * @Descripition
 */
@RestController
@RequestMapping("/biz/user")
@Tag(name = "用户管理控制器")
@Slf4j
public class BizUserController {
    @Resource
    private BizUserService bizUserService;
    @PostMapping("/login")
    @Operation(summary = "用户登录接口")
    public CommonResponse login(@RequestBody @Validated CustomerLoginParams customerLoginParams, HttpServletRequest request){
        LambdaQueryWrapper<BizUser> queryWrapper = new LambdaQueryWrapper<>();
        return CommonResponse.success("登录成功");
    }
    @PostMapping("/register")
    @Operation(summary = "用户注册接口")
    public CommonResponse register(@RequestBody @Validated BizUserAddParams bizUserAddParams){
        return bizUserService.register(bizUserAddParams)?CommonResponse.success("注册成功"):CommonResponse.success("注册失败");
    }
    @GetMapping("/list")
    @Operation(summary = "用户列表接口")
    public CommonResponse list(){
        return CommonResponse.success(bizUserService.list());
    }

}
